package com.bullsora.kindlerss.model

import org.quartz.CronExpression

class Subscription {
	String prefix
	Date lastChecked
	String sendCronExpression
	Boolean enabled
	Set feeds
	AppUser appUser

	List<Feed> nonEmptyFeeds

	static hasMany = [
		feeds: Feed
	]

	static constraints = {
		prefix blank: false
		lastChecked nullable: true
		sendCronExpression blank: false, validator : { value ->
			try {
				new CronExpression(value);
			} catch (e) {
				return false;
			}
			return true;
		}
	}

}
